// vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
export default defineConfig({
  // ...
  plugins: [
    // ...
    vue(),
    AutoImport({
      resolvers: [ElementPlusResolver()],
    }),
    Components({
      resolvers: [ElementPlusResolver()],
    }),
  ],
  // resolve: {
  //   // 别名
  //   alias: {
  //     "@": path.join(__dirname, "./src"),
  //   },
  //   // extensions: [".ts", ".js"],
  // },
  server: {
    port:5173,
    proxy: {
      '/api': {
        target: 'http://192.168.2.6:7001', // 实际请求地址
        changeOrigin: true,
        ws: true,
        rewrite: (path) => path.replace(/^\/api/, ""),
      }
    }
  }
})
